package com.caigou.modules.data.adpter

import android.widget.CheckBox
import com.caigou.modules.data.R
import com.caigou.modules.data.bean.DataTypeItemBean
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder

/**
 * @author #Suyghur.
 * Created on 2021/12/29
 */
class DataTypeItemAdapter(dataset: MutableList<DataTypeItemBean>) :
    BaseQuickAdapter<DataTypeItemBean, BaseViewHolder>(R.layout.item_data_type_list, dataset) {


    val checkBoxes = mutableListOf<CheckBox>()
    override fun convert(holder: BaseViewHolder, item: DataTypeItemBean) {
        with(holder.getView<CheckBox>(R.id.item_data_type_cb)) {
            text = item.categoryName
            if (item.categoryId == 1) {
                // 默认第一个
                isChecked = true
            }
            checkBoxes.add(this)
        }
    }
}